<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="login_container"></div>
</body>

<script src="https://downs.yaoulive.com/liveJs/axios.min.js"></script>
<script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
<script>
  var obj = new WxLogin({
    self_redirect: false,
    id: "login_container",
    appid: "wxa3fdea5a3090f",
    scope: "snsapi_login",
    redirect_uri: "https://www.xiang.com//client/index.html",
    // state: "",
    style: "white",
    href: "data:text/css;base64,LmxvZ2luUGFuZWwubm9ybWFsUGFuZWwgLnRpdGxlIHsNCiAgZGlzcGxheTogbm9uZTsNCn0NCi5xcmNvZGUubGlnaHRCb3JkZXIgew0KICB3aWR0aDogMTc0cHg7DQogIGhlaWdodDogMTc0cHg7DQogIG1hcmdpbi10b3A6IDA7DQogIGJveC1zaXppbmc6IGJvcmRlci1ib3g7DQp9DQouaW1wb3dlckJveCAuaW5mbyB7DQogIGRpc3BsYXk6IG5vbmU7DQp9DQoud2ViX3FyY29kZV90eXBlX2lmcmFtZSB7DQogIHdpZHRoOiAxNzRweDsNCn0NCg=="
  });

  // 这一步可以直接调用接口返回给后端code，由后端来进行这一步
  if (window.location.search.substring(6).split('&')[0]) {
    axios({
      'url': `https://api.weixin.qq.com/sns/oauth2/access_token?appid=wxa3fdea5a3090f&secret=53233913f94c0381aa53c1d8e&code=${window.location.search.substring(6).split('&')[0]}&grant_type=authorization_code`,
      'method': 'get'
    })
  }


</script>

</html>